package com.tanguy.user.ui.me.adapter

import android.view.View
import com.azhong.ratingbar.RatingBar
import com.tanguy.user.R
import com.tanguy.user.base.ImageViewTang
import com.tanguy.user.base.JustAdapter
import com.tanguy.user.bean.EvaluateDriver
import com.tanguy.user.utlis.TimeUtils
import com.tanguy.user.utlis.Utils.hideCarNumber
import com.tanguy.user.utlis.extend.setText
import com.tanguy.user.utlis.extend.toTimeString
import org.jetbrains.anko.find


/**
 * Created by dab on 2017/11/10 0010 17:13
 * 司机评价
 */
class EvaluateDriverAdapter(mData: ArrayList<EvaluateDriver>) : JustAdapter<EvaluateDriver>(mData, R.layout.item_evaluate) {
    override fun bind(itemView: View, data: EvaluateDriver, position: Int) {
        itemView.apply {
            find<View>(R.id.view_images).visibility = View.GONE
            find<ImageViewTang>(R.id.iv_portrait).setImageURI(data.imgHead)
            setText(R.id.tv_name_number, data.name + "  ${hideCarNumber(data.plate)}")
            setText(R.id.tv_time, data.addtime.toTimeString(TimeUtils.TIME_YYYY_MM_DD))
            setText(R.id.tv_msg, data.content)
            setText(R.id.tv_grade, data.score.toString())
            find<RatingBar>(R.id.rb_grade).star = data.score
        }

    }



}